package com.example.XuLieHua;

import java.io.*;

public class ObjectInputStreams {
    public static void main(String[] args) {
    MyClass obj = null;
        try {
            // 打开要被序列化的文件
            FileInputStream fos = new FileInputStream("C:/Users/47054/Desktop/hello/cc.txt");

            ObjectInputStream objin = new ObjectInputStream(fos);

            obj = (MyClass) objin.readObject();
            objin.close();
            fos.close();

        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        System.out.println("Deserialized Employee...");
        System.out.println("Name: " + obj.name);
        System.out.println("Address: " + obj.address);
        System.out.println("SSN: " + obj.SSN);
        System.out.println("Number: " + obj.number);
    }
}
